package com.harry.rabbitmqhello;

import org.springframework.amqp.core.AmqpTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.Date;

/**
 * @author Harry
 * @date 2018/3/30 14:37
 */
@Component
public class Sender {


    @Autowired
    private AmqpTemplate amqpTemplate;


    public void send1() {
        String context = "hi, i am message 1";
        System.out.println("Sender : " + context);
        this.amqpTemplate.convertAndSend("exchange", "topic.message", context);
    }

    public void send2() {
        String context = "hi, i am messages 2";
        System.out.println("Sender : " + context);
        this.amqpTemplate.convertAndSend("exchange", "topic.messages", context);
    }

    public void send3() {
        String context = "hi, i am messages 3";
        System.out.println("Sender : " + context);
        this.amqpTemplate.convertAndSend("exchange", "topic.queue_name_was", context);
    }

    public void send4() {
        String context = "hi, i am messages 4";
        System.out.println("Sender : " + context);
        this.amqpTemplate.convertAndSend("exchange", "topic.qnw", context);
    }



}
